void main() async {
  bool isTimeout = false;
  String name = await _getName().timeout(
    Duration(milliseconds: 2),
    onTimeout: () {
      isTimeout = true;
      print("on timeout");
      return "timeout";
    },
  );
  print("isTimeout == $isTimeout");
  print("name == $name");
}

Future<String> _getName() async {
  await Future.delayed(Duration(milliseconds: 4));
  return "name";
}
